home *** CD-ROM | disk | FTP | other *** search
- Path: news.ahc.ameritech.com!datalytics!news
- From: Rob Stewart <stew@datalytics.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Operator Overloading
- Date: 4 Jan 1996 21:47:17 GMT
- Organization: Datalytics, Inc
- Message-ID: <4chht5$s2h@gold.datalytics.com>
- References: <4chdhb$g64@news.cs.hope.edu>
- NNTP-Posting-Host: pc071.datalytics.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
-
- vnopstal@cs.hope.edu (Michael Van Opstall) wrote:
- >A couple of questions on operator overloading:
- >
- >1. If you overload ==, do you have to overload != as well?
- >
- If you supply the one, someone will code the opposite
- conditional sometime and expect to be able to use the other.
- Likewise, if you provide ++(+, *, etc.), you should seriously
- consider --(-, /, etc.).
-
- >2. What is the accepted method for overloading >> and <<? The way I do it
- >is not very cool and not slick at all. Should I be including streams and doing
- >stream manipulation? That makes sense.
- >
- If you're doing streams manipulation, do streams manipulation.
- Remember, >> and << were (are) bit shift operators. The
- iostreams classes changed that behavior. Was that the right
- thing to do? Perhaps for your class bit shifting is the right
- behavior for these operators.
-
- --
- Robert Stewart | My opinions are usually my own.
- Datalytics, Inc.
- (513)226-7700
- stew@datalytics.com
-
-
-